
using System;
using System.Collections.Generic;
using System.Text;
using NFinal.Extension;

namespace WebApplication1.DDD.Models.Entity.Common
{
    public struct article_category:NFinal.IModel
    {
		public System.Int64 id;
		public System.Int64? channel_id;
		public System.String title;
		public System.Int64? parent_id;
		public System.String class_list;
		public System.Int64? class_layer;
		public System.Int64? sort_id;
		public System.String link_url;
		public System.String img_url;
		public System.String content;
		public System.String seo_folder;
		public System.String seo_title;
		public System.String seo_keywords;
		public System.String seo_descrition;
		#region Nullable
		private bool __is_null__;
        public bool __Is_Null__
        {
            get {
                return __is_null__;
            }
            set
            {
                 __is_null__=value;
            }
        }
        public static implicit operator article_category(string __value__)
        {
            var __value2__ = new article_category();
            __value2__.__Is_Null__ = __value__==null;
            return __value2__;
        }
        public static  bool operator true(article_category __value__)
        {
            return !__value__.__is_null__;
        }
        public static bool operator false(article_category __value__)
        {
            return !__value__.__is_null__;
        }
		#endregion
		#region 从get列表初始化实体类
		public static bool TryParse(NFinal.NameValueCollection get,out article_category par)
		{
			par=new article_category();
			try
			{
						System.Int64.TryParse(get["id"],out par.id);
						par.channel_id=null;
						if(get["channel_id"]!=null)
						{
							par.channel_id=get["channel_id"].AsVar();
						}
						par.title=get["title"];
						par.parent_id=null;
						if(get["parent_id"]!=null)
						{
							par.parent_id=get["parent_id"].AsVar();
						}
						par.class_list=get["class_list"];
						par.class_layer=null;
						if(get["class_layer"]!=null)
						{
							par.class_layer=get["class_layer"].AsVar();
						}
						par.sort_id=null;
						if(get["sort_id"]!=null)
						{
							par.sort_id=get["sort_id"].AsVar();
						}
						par.link_url=get["link_url"];
						par.img_url=get["img_url"];
						par.content=get["content"];
						par.seo_folder=get["seo_folder"];
						par.seo_title=get["seo_title"];
						par.seo_keywords=get["seo_keywords"];
						par.seo_descrition=get["seo_descrition"];
			}
			catch
			{
				return false;
			}
			return true;
		}
		#endregion
		#region 写Json字符串
		public void WriteJson(System.IO.TextWriter tw)
		{
			tw.Write("{");
					tw.Write("\"id\":");
					tw.Write(id.ToString());
					tw.Write(",");
					tw.Write("\"channel_id\":");
					tw.Write(channel_id==null?"null" : channel_id.ToString());
					tw.Write(",");
					tw.Write("\"title\":");
					tw.Write("\"");
					tw.Write(title==null?"null":title);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"parent_id\":");
					tw.Write(parent_id==null?"null" : parent_id.ToString());
					tw.Write(",");
					tw.Write("\"class_list\":");
					tw.Write("\"");
					tw.Write(class_list==null?"null":class_list);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"class_layer\":");
					tw.Write(class_layer==null?"null" : class_layer.ToString());
					tw.Write(",");
					tw.Write("\"sort_id\":");
					tw.Write(sort_id==null?"null" : sort_id.ToString());
					tw.Write(",");
					tw.Write("\"link_url\":");
					tw.Write("\"");
					tw.Write(link_url==null?"null":link_url);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"img_url\":");
					tw.Write("\"");
					tw.Write(img_url==null?"null":img_url);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"content\":");
					tw.Write("\"");
					tw.Write(content==null?"null":content);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"seo_folder\":");
					tw.Write("\"");
					tw.Write(seo_folder==null?"null":seo_folder);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"seo_title\":");
					tw.Write("\"");
					tw.Write(seo_title==null?"null":seo_title);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"seo_keywords\":");
					tw.Write("\"");
					tw.Write(seo_keywords==null?"null":seo_keywords);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"seo_descrition\":");
					tw.Write("\"");
					tw.Write(seo_descrition==null?"null":seo_descrition);
					tw.Write("\"");

			tw.Write("}");
		}
		#endregion
    }
}
